<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <input type="text" placeholder="输入不少于5位的用户名，并且只能为字母开始后跟数字或下划线" style="width: 100%" />
        <div id="error"></div>
        <script>
            let input = document.querySelector('input')
            input.addEventListener('input', function () {
                console.log(this.value)
            })
        </script>
    </body>
</html>
